<!DOCTYPE html>

<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8"/>
    <title>Title</title>
    <script src="http://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js"></script>
    <script type="text/javascript">
        function login() {
            $.ajax({
                //几个参数需要注意一下
                type: "POST",//方法类型
                dataType: "json",//预期服务器返回的数据类型
                url: "/loginin" ,//url
                data: $('#form1').serialize(),
                success: function (result) {
                    console.log(result);//打印服务端返回的数据(调试用)
                    if (result.code == 1) {
                        window.location.href = 'http://localhost:8080';
                    }
                    ;
                },
                error : function() {
                    alert("异常！");
                }
            });
        }
    </script>
</head>

<body>
  <form id="form1" onsubmit="return false" action="##" method="post">
      <input th:type="hidden" name="password" th:value="${base64.encodeBase64String(rsaObj.getRsa().RSAEncode(rsaObj.getPublicKey(),'hello'.getBytes()))}"/>
      <p><input type="button" value="登录" onclick="login()">&nbsp;<input type="reset" value="重置"></p>
  </form>
</body>
</html>